// Created by WXX on 2021/9/19 10:33
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

class Solution {
public:
    int minSteps(int n) {
        int res = 0;
        for (int i = 2; i <= n / i; i++)
            while (n % i == 0) {
                res += i;
                n /= i;
            }
        if (n > 1) res += n;
        return res;
    }
};

int main() {

    cout << Solution().minSteps(3) << endl;  // 3
    cout << Solution().minSteps(14) << endl;  // 9

    return 0;
}
